package com.example.excelgenera.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.kafka.annotation.EnableKafka;
import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@EnableKafka
@RestController
public class Hello {
    @Autowired
    private KafkaTemplate<String, String> kafkaTemplate;
    private static int count = 0;
    @GetMapping(value = "/hello")
    public void hello(){
        count++;
        kafkaTemplate.send("tutorialspoint", count+"hello");
    }
    public void sendMessage(String msg) {
        kafkaTemplate.send("tutorialspoint", msg);
    }
}
